#ifndef RENDERER_H
#define RENDERER_H
#include <d3d9.h>
#include "Structs.h"
#include "VertexBuffer.h"
#include "Defines.h"
#include <d3dx9.h>

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

class Renderer
{
public:
	Renderer(HWND hWnd);
	~Renderer(void);
	void Draw(ColorVertex * pVtxCollection, D3DPRIMITIVETYPE primitiveType, unsigned int uiVtxCount);
	void StartFrame();
	void EndFrame();

	void setMatrixMode (MatrixMode eMode);
	void loadIdentity ();
	void translate (float fX, float fY, float fZ = 0.0f);
	void rotateX (float fAngle);
	void rotateY (float fAngle);
	void rotateZ (float fAngle);
	void scale (float fW, float fH);

	void setViewportPosition(float fPosX, float fPosY);



private:
	HWND m_hWnd;
	IDirect3DDevice9*  m_pkDevice;
	void D3D_Initialize(HWND hWnd);

	VertexBuffer<ColorVertex,COLOR_VERTEX> m_pkVertexBuffer;

	D3DXMATRIX m_mProjectionMatrix;
	
	// current matrix mode
	MatrixMode m_eCurrentMatMode;
	
	D3DXVECTOR3 m_kViewerPos;
	D3DXVECTOR3 m_kViewerUp;
	float m_fViewerAngle;

	
};
#endif
